var resource_xWinTitle = "标题";
var resource_collapse = "折叠";
//var resource_hide = "隐藏";
var resource_hide = "Close";
var resource_expand = "展开";
var _height=200;

var arrDistrictS=["Central & Western","Wan Chai","Eastern","Southern","Yau Tsim Mong","Kowloon City","Wong Tai Sin","Kwun Tong","Sham Shui Po","Kwai Ching","Tsueng Wan", "Tuen Mun", "Islands", "Yuen Long", "North", "Tai Po", "Sha Tin", "Sai Kung"];
var arrKeywordS=["Building", "Road", "Estate", "Garden", "Plaza"];

var lastOpenWinID=-1;
var lastOpenWinCommand='';

function selectDistrict(theDist, theSource) {
	var tempStr = e(theSource).value;
	var a_pos = tempStr.indexOf("@");
	if (a_pos > -1)
	{
		tempStr = tempStr.substring(0, a_pos);
	}
	e(theSource).value = tempStr + "@" + theDist; 
	if (theSource == 'from'){
		clearInputFrom();	
	}else{
		clearInputTo();	
	}
	hide(e(theSource + "DistrictWin"));
}

function selectKeyword(theKey, theSource) {
	e(theSource).value = theKey; 
	if (theSource == 'from'){
		clearInputFrom();	
	}else{
		clearInputTo();	
	}
	hide(e(theSource + "KeywordWin"));
}

function clearSelectWin() {
	if (e("fromDistrictWin")){ hide(e("fromDistrictWin")); }
	if (e("toDistrictWin")){ hide(e("toDistrictWin")); }
	if (e("fromKeywordWin")){ hide(e("fromKeywordWin")); }
	if (e("toKeywordWin")){ hide(e("toKeywordWin")); }
	if (e("pedZone")){ hide(e("pedZone")); }
	if (e("legend")){ hide(e("legend")); }
	if (e("referenceWin")){ hide(e("referenceWin")); }		
	
	if (e("Vehicle")){ hide(e("Vehicle")); }
	if (e("Turn")){ hide(e("Turn")); }
	
	lastOpenWinID=-1;
	lastOpenWinCommand='';
}

function clearSelectWin2(id) {
	if (e("fromDistrictWin")){ hide(e("fromDistrictWin")); }
	if (e("toDistrictWin")){ hide(e("toDistrictWin")); }
	if (e("fromKeywordWin")){ hide(e("fromKeywordWin")); }
	if (e("toKeywordWin")){ hide(e("toKeywordWin")); }
	if (e("pedZone")){ hide(e("pedZone")); }
	if (e("legend")){ hide(e("legend")); }
	if (e("referenceWin")){ hide(e("referenceWin")); }		
	
	if (e("Vehicle")){ hide(e("Vehicle")); }
	if (e("Turn")){ hide(e("Turn")); }
	
	if(lastOpenWinID == id){
		eval(lastOpenWinCommand);
	}
	else{
		lastOpenWinID=-1;
		lastOpenWinCommand='';
	}
}

function openDistrictWin(theSource) {
	clearSelectWin();
	var w_height = 160;
	var w_width = 200;
	var theWin;
	var w_top;
	if (theSource == "from")
	{
		theWin = "fromDistrictWin";
		w_top = 110;
	} else {
		theWin = "toDistrictWin";
		w_top = 141;
	}
	var dirHtml='<DIV id="district_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
		+ '<DIV style="width:100%;"><TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
		+ '<TR height="17"><TD valign="top" align="left" class="normalText">' + dispSelectDistrict[langMod] + ':</TD>'
		+ '<TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD></tr>'
		+ '</TBODY></TABLE></DIV>'
		+ '<DIV style="height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
		+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
		for(var i=0; i < dispDists[langMod].length; i++){
			dirHtml = dirHtml + '<TR height="13"><TD valign=top align=left class="normalText"><a href="#" onClick="selectDistrict(\''+ dispDists[langMod][i] + '\',\''+ theSource +'\')">' + dispDists[langMod][i] + '</a></td></TR>';
		}  

	dirHtml +='</TBODY></TABLE></DIV><DIV>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,e("s1_div").clientWidth-46,w_top,w_width,w_height,9999,"Select District",dirHtml,"hidden");
	}else{
		//win1.childNodes[1].innerHTML = dirHtml;
		show(win1);
	}
}

function openKeywordWin(theSource) {
	clearSelectWin();
	var w_height = 320;
	var w_width = 520;
	var theWin;
	var w_top;
	if (theSource == "from")
	{
		theWin = "fromKeywordWin";
		w_top = 110;
	} else {
		theWin = "toKeywordWin";
		w_top = 141;
	}
	var dirHtml='<DIV id="keyword_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
		+ '<DIV style="width:100%;"><TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
		+ '<TR height="17"><TD valign="top" align="left class="normalText">' + dispSelectKeyword[langMod] + ':</TD>'
		+ '<TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD>'
		+ '</tr></TBODY></TABLE></DIV>'
		+ '<DIV style="height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
		+ '<TABLE width="100%" align="left" cellspacing="0" cellpadding="0" border="0"><TBODY>';
	for(var i=0; i < dispKeys[langMod].length; i++){
		dirHtml = dirHtml + '<TR height="13"><TD valign=top align=left class="normalText">'
			+ '<strong>' + dispKeys[langMod][i][0] +'</strong>'
			+ '</td></TR><TR height="13"><TD valign=top align=left class="normalText">';
		for (var j=1; j<dispKeys[langMod][i].length; j++){
			dirHtml = dirHtml + '<a href="#" onClick="selectKeyword(\'' + dispKeys[langMod][i][j] + '\',\'' + theSource + '\')">' + dispKeys[langMod][i][j] + '</a>&nbsp;';
		}
		dirHtml = dirHtml + '</TD></TR><TR height="13"><TD valign=top align=left class="normalText"></td></TR>';
	}
	dirHtml +='</TBODY></TABLE></DIV><DIV>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,e("s1_div").clientWidth-101,w_top,w_width,w_height,9999,"Select Keyword",dirHtml,"hidden");
	}else{
		//win1.childNodes[1].innerHTML = dirHtml;
		show(win1);
	}
}

function openPedZone(roadID,id) {
	//alert (roadID);
	clearSelectWin();
	var w_height = 140;
	var w_width = 300;
	var theWin = "pedZone";
	var w_top = 200;
	var w_left = 400;
	
	var dirHtml='<DIV id="ped_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
				+ '<DIV style="width:100%;">'
				+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
				+ '<TR height="17"><TD valign="top" align="left" class="normalText">' + dispPartTimePedestrianStreet[langMod] + ':</TD><TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD></tr>'
				+ '</TBODY></TABLE></DIV>'
				+ '<DIV style="height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
				+ '<iframe width=290 height=100 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getPedZone.php?lang=' + lang + '&id=' + roadID + '"></iframe>'
				+ '</DIV><DIV>';
			
	//var dirHtml='<iframe width=90 height=120 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getPedZone.php?id=' + roadID + '"></iframe>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,w_left,w_top,w_width,w_height,9999,"Pedestrian Zone",dirHtml,"hidden");
	}else{
		win1.childNodes[0].innerHTML = "";
		win1.childNodes[0].innerHTML = dirHtml;
		show(win1);
	}
	
	lastOpenWinID=id;
	lastOpenWinCommand = "openPedZone(" + roadID + "," + id + ");";
}

function openVehicle(VehicleID,id) {
	//alert (roadID);
	clearSelectWin();
	var w_height = 140;
	var w_width = 300;
	var theWin = "Vehicle";
	var w_top = 200;
	var w_left = 400;

	var tempID = VehicleID
	var arrVehicleID = tempID.split("a");
	var VID = arrVehicleID[1];
	var OID = arrVehicleID[2];
	var dirHtml='<DIV id="ped_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
				+ '<DIV style="width:100%;">'
				+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
				+ '<TR height="17"><TD valign="top" align="left" class="normalText"><b><u>' + dispVehicle[langMod] + ':</u></b></TD><TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD></tr>'
				+ '</TBODY></TABLE></DIV>'
				+ '<DIV style="width:290px; height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
				+ '<iframe width=290 height=200 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getVehicle.php?lang=' + lang + '&vid=' + VID + '&oid=' + OID + '"></iframe>'
				+ '</DIV><DIV>';
			
	//var dirHtml='<iframe width=90 height=120 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getPedZone.php?id=' + roadID + '"></iframe>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,w_left,w_top,w_width,w_height,9999,"Vehicle Restriction",dirHtml,"hidden");
	}else{
		win1.childNodes[0].innerHTML = "";
		win1.childNodes[0].innerHTML = dirHtml;
		show(win1);
	}
	
	lastOpenWinID=id;
	lastOpenWinCommand = "openVehicle('" + VehicleID + "'," + id + ");";
}

function openProhibitions(PID,id) {
var oPID=PID;
	clearSelectWin();
	var w_height = 140;
	var w_width = 300;
	var theWin = "Vehicle";
	var w_top = 200;
	var w_left = 400;
	var tempID = PID
	var arrPID = tempID.split("a");
	var PID = arrPID[1];
	var OID = arrPID[2];
	var dirHtml='<DIV id="ped_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
				+ '<DIV style="width:100%;">'
				+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
				+ '<TR height="17"><TD valign="top" align="left" class="normalText"><b><u>' + dispProhibitions[langMod] + ':</u></b></TD><TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD></tr>'
				+ '</TBODY></TABLE></DIV>'
				+ '<DIV style="width:290px; height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
				+ '<iframe width=270 height=200 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getProhibitions.php?lang=' + lang + '&pid=' + PID + '&oid=' + OID + '"></iframe>'
				+ '</DIV><DIV>';
			
	var win1=document.getElementById(theWin);
	if(!win1){
		new xWin(theWin,w_left,w_top,w_width,w_height,9999,"Vehicle Prohibitions",dirHtml,"hidden");
	}else{
		win1.childNodes[0].innerHTML = "";
		win1.childNodes[0].innerHTML = dirHtml;
		show(win1);
	}
	
	lastOpenWinID=id;
	lastOpenWinCommand = "openProhibitions('" + oPID + "'," + id + ");";
}

function openTurn(TurnID,id) {
	//alert (roadID);
	clearSelectWin();
	var w_height = 140;
	var w_width = 300;
	var theWin = "Turn";
	var w_top = 200;
	var w_left = 400;
	
	var dirHtml='<DIV id="ped_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
				+ '<DIV style="width:100%;">'
				+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
				+ '<TR height="17"><TD valign="top" align="left" class="normalText"><b><u>' + dispTurn[langMod] + ':</u></b></TD><TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD></tr>'
				+ '</TBODY></TABLE></DIV>'
				+ '<DIV style="width:290px; height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
				+ '<iframe width=270 height=200 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getTurn.php?lang=' + lang + '&id=' + TurnID + '"></iframe>'
				+ '</DIV><DIV>';
			
	//var dirHtml='<iframe width=90 height=120 frameborder="0" scrolling="no" src="http://203.194.149.169/drss/getPedZone.php?id=' + roadID + '"></iframe>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,w_left,w_top,w_width,w_height,9999,"Turn Restriction",dirHtml,"hidden");
	}else{
		win1.childNodes[0].innerHTML = "";
		win1.childNodes[0].innerHTML = dirHtml;
		show(win1);
	}
	
	lastOpenWinID=id;
	lastOpenWinCommand = "openTurn(" + TurnID + "," + id + ");";
}
	
function openReferenceWin() {
	clearSelectWin();
	var w_height = 140;
	var w_width = 250;
	var theWin;
	var w_top;
	w_top = 145;
	theWin = "referenceWin";
	var dirHtml='<DIV id="reference_details" style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">'
		+ '<DIV style="width:100%;"><TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
		+ '<TR height="17"><TD valign="top" align="left class="normalText">' + '&nbsp;</TD>'
		+ '<TD width="14" valign="top" align="right"><img title='+resource_hide+' alt='+resource_hide+' style="height:13px" src="./images/hide.gif" onclick="hide(e(\''+ theWin +'\'))"></TD>'
		+ '</tr></TBODY></TABLE></DIV>'
		+ '<DIV style="height:' + (w_height-10-17) + 'px; margin-right: 1px; overflow-x: hidden; overflow-y: auto;">'
		+ '<TABLE width="100%" align="center" cellspacing="0" cellpadding="0" border="0"><TBODY>'
		+ '<TR height="13"><TD valign=top align=left class="normalText">' + referenceDesc[langMod] + '</td></TR>';
	dirHtml +='</TBODY></TABLE></DIV><DIV>';
	var win1=document.getElementById(theWin);
	if(!win1){
		//var w_height = windowHeight() - document.getElementById('toolbar').offsetHeight-10;
		new xWin(theWin,e("s1_div").clientWidth-76,w_top,w_width,w_height,9999,"Reference Time",dirHtml,"hidden");
	}else{
		//win1.childNodes[1].innerHTML = dirHtml;
		show(win1);
	}
}

// 创建一个对象;
// new xwin("myWin", 0, 0, 200, 200, 1, "the Title", "the Content", 0.8, "red");
function xWin(id,left,top,width,height,zIndex,title,content,_overflow,opacity,color)
{
	if(!left){ left=0; }
	if(!top){ top=0; }
    if(!width){	width = 200;}
	if(!height){height = 200;}
	//_height= height + 2;
	_height= height ;
	if(!zIndex){ zIndex=1; }
	if(!opacity){ opacity = 1.0;}
	if(!color){	color = "#00AE8E";}
	if(!title){	title = resource_xWinTitle;	}
	if(!content){content = "";}
	if (!_overflow ){_overflow ="auto";}
	var headHeight = 20;
	//Div
	var win = document.createElement("Div");
	win.id = id;
	win.style.left = left+"px";
	win.style.top = top+"px";
	win.style.width = width+2+"px";
	win.style.height = height+2+"px";
	win.style.position = "absolute";
	win.style.zIndex = zIndex;
	win.style.filter="alpha(opacity="+opacity*100+")";
	win.style.opacity=opacity;
	document.body.appendChild(win);
	//head
/*	var win_head = document.createElement("Div");
	win_head.id = id+"_head";
	var imgLeft1 = width-40;
	var imgLeft2 = width-20;
	//win_head.innerHTML = "<span style='position:absolute;cursor:default'>"+":::"+title+"</span><span style='position:absolute;left:"+imgLeft1+"px;cursor:default'><img title="+resource_collapse+" alt="+resource_collapse+" style='height:13px;' src='./images/collapse.gif' onclick ='controlDiv(this.parentNode.parentNode.parentNode)' ></span>  <span style='position:absolute;left:"+imgLeft2+"px;cursor:default'><img  title="+resource_hide+" alt="+resource_hide+" style='height:13px' src='./images/hide.gif' onclick='hide(this.parentNode.parentNode.parentNode)'> </span>";
	//win_head.innerHTML = "<span style='position:absolute;cursor:default'>"+""+title+"</span><span style='float: right; width: 20px;cursor:default'><img  title="+resource_hide+" alt="+resource_hide+" style='height:13px' src='./images/hide.gif' onclick='hide(this.parentNode.parentNode.parentNode)'> </span><span style='float: right; width: 20px;cursor:default'><img title="+resource_collapse+" alt="+resource_collapse+" style='height:13px;' src='./images/collapse.gif' onclick ='controlDiv(this.parentNode.parentNode.parentNode)' ></span>";
	win_head.innerHTML = "<span style='position:absolute;cursor:default'>"+""+title+"</span><span style='float: right; width: 20px;cursor:default'><img  title="+resource_hide+" alt="+resource_hide+" style='height:13px' src='./images/hide.gif' onclick='hide(this.parentNode.parentNode.parentNode)'> </span>";
	win_head.style.left = "0px";
	win_head.style.top = "0px";
	win_head.style.width = width-4+"px";
	win_head.style.height =headHeight+"px";
	win_head.style.position = "absolute";
	win_head.style.overflow = "hidden";
	win_head.style.backgroundColor=color;
	win_head.style.color="white";
	win_head.style.fontSize="14px";
	win_head.style.border="1px solid "+color;
	win_head.style.cursor ="move";
	win.appendChild(win_head);*/
	//body
	var win_body = document.createElement("Div");
	win_body.id = id+"_body";
	win_body.style.left = "0px";
	//win_body.style.top = headHeight+4+"px";
	win_body.style.top = "0px";
	//win_body.style.width = width-4+"px";
	win_body.style.width = width+"px";
	//win_body.style.height =height-24+"px";
	win_body.style.height =height+"px";
	win_body.style.position = "absolute";
	//win_body.style.overflow = "hidden";
	win_body.style.overflow = _overflow;
	win_body.style.backgroundColor = "white";
	win_body.style.fontSize="12px";
	win_body.style.border="1px solid "+color;
	win_body.innerHTML = content;
	win.appendChild(win_body);
	//yahoo.dragdrop
	//dd = new YAHOO.util.DD(id);
	//dd.setHandleElId(id+"_head");
      
}

//折叠或展开;
function controlDiv(obj)
{
		//obj:body
		var flg = obj.childNodes[1].style.display=="none";
		if(flg){
			obj.style.height=_height + "px" ;
			obj.childNodes[1].style.display = "block";
			var img = obj.childNodes[0].childNodes[2].childNodes[0];
			img.title = resource_collapse;
			img.alt = resource_collapse;
			img.src = "./images/collapse.gif";
		}
		else{
			obj.style.height="19px" ;
			obj.childNodes[1].style.display = "none";
			var img = obj.childNodes[0].childNodes[2].childNodes[0];
			img.title = resource_expand;
			img.alt = resource_expand;
			img.src = "./images/expand.gif";
		}
		
}
//关闭;
function hide(obj)
{
        //为兼容firefox,先折叠，再不可见
		//obj.childNodes[1].style.display = "none";
		obj.style.visibility = "hidden";
        
}
//打开 
function show(obj)
{ 
		obj.style.height=_height + "px" ;
		//obj.childNodes[1].style.display = "block";
		//var img = obj.childNodes[0].childNodes[2].childNodes[0];
		//img.title = resource_collapse;
		//img.alt = resource_collapse;
		//img.src = "./images/collapse.gif";
		obj.style.visibility = "visible";
}

function switchDiv(obj)
{
	if(obj.style.visibility == "hidden"){
		//展开,显示
		obj.childNodes[1].style.display = "block";
		var img = obj.childNodes[0].childNodes[2].childNodes[0];
		img.title = resource_collapse;
		img.alt = resource_collapse;
		img.src = "./images/collapse.gif";
		obj.style.visibility = "visible";
	}else{
		//折叠，隐藏
		obj.childNodes[1].style.display = "none";
		var img = obj.childNodes[0].childNodes[2].childNodes[0];
		img.title = resource_expand;
		img.alt = resource_expand;
		img.src = "./images/expand.gif";
		obj.style.visibility = "hidden";

	}
}

function showLoading()
{
    var divPU;
    var divPUImg;
    var divBG;
    
    if(document.getElementById){
	    // Standard way to get element
	    divPU = document.getElementById('popupWindow'); 
	    divPUImg = document.getElementById('popupWindowImg'); 
	    divBG = document.getElementById('backgroundFilter'); 
    }else if(document.all) {
    	// Get the element in old IE's 
    	divPU = document.all['popupWindow']; 
    	divPUImg = document.getElementById('popupWindowImg'); 
    	divBG = document.all['backgroundFilter']; 
    }
    if (onlineCount>200){
    	if (lang=='E'){
    		divPUImg.src="images/loading_busy.gif";
			}else if (lang=='TC'){
				divPUImg.src="big5/images/loading_busy.gif";
			}else if (lang=='SC'){
				divPUImg.src="gb/images/loading_busy.gif";
			}else{
				divPUImg.src="images/loading_busy.gif";
			}
    }else{
    	if (lang=='E'){
    		divPUImg.src="images/loading.gif";
			}else if (lang=='TC'){
				divPUImg.src="big5/images/loading.gif";
			}else if (lang=='SC'){
				divPUImg.src="gb/images/loading.gif";
			}else{
				divPUImg.src="images/loading.gif";
			}
    }
    
    divBG.style.display = 'block';
    divPU.style.display = 'block';

    divPU.style.left = (windowWidth() - 240)/2 + 'px';
    divPU.style.top = (windowHeight() - 150)/2 + 'px';
}

function hideLoading()
{
    var divPU;
    var divBG;
    
    if(document.getElementById){
	    // Standard way to get element
	    divPU = document.getElementById('popupWindow'); 
	    divBG = document.getElementById('backgroundFilter'); 
    }else if(document.all) {
    	// Get the element in old IE's 
    	divPU = document.all['popupWindow']; 
    	divBG = document.all['backgroundFilter']; 
    }
    divPU.style.display = 'none';
    divBG.style.display = 'none';
}

function showLegend()
{
    var divPU;
    var divBG;
    
    if(document.getElementById){
	    // Standard way to get element
	    divPU = document.getElementById('legendWindow'); 
    }else if(document.all) {
    	// Get the element in old IE's 
    	divPU = document.all['legendWindow']; 
    }
    divPU.style.display = 'block';

    //divPU.style.left = (windowWidth() - 180) + 'px';
    //divPU.style.top = (windowHeight() - 195) + 'px';
    divPU.style.left = (1024 - 190) + 'px';
    divPU.style.top = (768 - 420) + 'px';
}

function hideLegend()
{
    var divPU;
    var divBG;
    
    if(document.getElementById){
	    // Standard way to get element
	    divPU = document.getElementById('legendWindow'); 
    }else if(document.all) {
    	// Get the element in old IE's 
    	divPU = document.all['legendWindow']; 
    }
    divPU.style.display = 'none';
}

function openTips()
{
	var winStats='resizable=no,status=no,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,left=50,top=100,width=450,height=330';
	var pop=window.open("","tips",winStats)
	if (parseInt(navigator.appVersion) >=4) pop.window.focus();
	var strTips;
	strTips = '<html>';
	strTips = strTips + '<HEAD>';
	strTips = strTips + '<TITLE>HKeRouting</TITLE>';
	strTips = strTips + '<META http-equiv=Content-Type content="text/html; charset=utf-8">';
	strTips = strTips + '<link href="css/drss_m.css" rel="stylesheet" type="text/css">';
	strTips = strTips + '</HEAD>';
	strTips = strTips + '<body text=#000000 bgcolor=#ffffff link=#007700 vlink=#000088 alink=#000000 style="margin-top:5px; margin-right:5px; margin-bottom:5px; margin-left:5px;">';
	strTips = strTips + getTips();
	strTips = strTips + '</body>';
	strTips = strTips + '</html>';
	pop.document.open();
	pop.document.write(strTips);
	pop.document.close();

}
